package sctu.edu.java.year2016.team08.chenjing.day20150530.chapter9_1;

/**
 * 编写一个java程序，创建一个类，并在类中创建一个成员内部类，通过成员内部类计算1到任意数的和的操作，并在外部类中进行测试。
 * Created by AD on 2016/5/30.
 */
public class OutClass {
    InnerClass in = new InnerClass();

    public void outf() {
        in.jisuan();


    }

    public class InnerClass {
        public void jisuan() {

            int sum = 0;
            for (int i = 1; i <= 6; i++) {
                sum = sum + i;
            }
            System.out.println(sum);
        }
    }

    public InnerClass inf() {
        in.jisuan();
        return new InnerClass();

    }

    public static void main(String[] args) {
        OutClass out = new OutClass();
        OutClass.InnerClass a = out.inf();
        out.outf();
        a.jisuan();

    }
}
